package com.stefanini.pe.bbva.iivs.in.rpt;

import java.util.List;

import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField;

import com.stefanini.pe.bbva.iivs.in.to.TipoDocumento;

public class DataSourceSubReporteSolicitud  implements JRDataSource {

	private List lstDatos;	
	private int index = -1;
	
	public DataSourceSubReporteSolicitud(List lstDatos) {
		this.lstDatos=lstDatos;	
	}

	public Object getFieldValue(JRField field) throws JRException {
		TipoDocumento tipoDocumento = (TipoDocumento) lstDatos.get(index);
		 Object value = null;
		 String fieldName = field.getName();		
				 	 
		 	if ("codigo".equals(fieldName)){
				value = tipoDocumento.getCodDoc();
			}
			else if ("descripcion".equals(fieldName)){
				value = tipoDocumento.getDesDoc();
			}		
		 
		return value;
	}

	public boolean next() throws JRException {
		index++;
		return (index < this.lstDatos.size());
	}

}
